<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<script>
		let ws = new WebSocket('ws://localhost:8080/');
		ws.emit = function(name, ...args) {
			ws.send(JSON.stringify({name,data: [...args]}));
		}
		// 连接成功
		ws.onopen = function() {
			ws.emit('msg', 12, 5);
		}
		// 有数据返回
		ws.onmessage = function() {}
		// 断开了
		ws.onclose = function() {}

	</script>
</head>
<body>
	
</body>
</html>